<?php

set_time_limit(240);
require dirname(__FILE__).'/config.php';

require WP_VERSION_PATH . '/library/tokenizer.php';
require WP_VERSION_PATH . '/library/version_writer.php';

if(true === USE_SQLITE)
{
	require WP_VERSION_PATH . '/library/sqlite_save.php';
}
else if(true === USE_MYSQL)
{
	require WP_VERSION_PATH . '/library/mysql_save.php';
}

function version_header()
{
?>
<style type="text/css">
#wp-version-container {
width: 100%;
}

thead th {
	color: #fff;
	font-size: 11px;
}
th.header-alt {
	background-color: #999;
}

td {
	text-align: center;
	font-size: 12px;
}

td.version-alt {
	background-color: #ccc;
}

.ver-exists
{
	font-weight: bold;
}
</style>
<?php
}

function version_table_print($wpversion, $type)
{
?>
<table cellpadding="0" cellspacing="2" width="100%" border="0">
	<thead>
		<tr>
			<th style="text-align: left;">Name</th>
			<th class="header-alt">0.71</th>
			<th>1.0.0</th>
			<th class="header-alt">1.0.1</th>
			<th>1.0.2</th>
			<th class="header-alt">1.2.0</th>
			<th>1.2.1</th>
			<th class="header-alt">1.2.2</th>
			<th>1.5.0</th>
			<th class="header-alt">1.5.1</th>
			<th>1.5.2</th>
			<th class="header-alt">2.0.0</th>
			<th>2.0.1</th>
			<th class="header-alt">2.0.4</th>
			<th>2.0.5</th>
			<th class="header-alt">2.0.6</th>
			<th>2.0.7</th>
			<th class="header-alt">2.0.8</th>
			<th>2.0.9</th>
			<th class="header-alt">2.0.10</th>
			<th>2.0.11</th>
			<th class="header-alt">2.1.0</th>
			<th>2.1.1</th>
			<th class="header-alt">2.1.2</th>
			<th>2.1.3</th>
			<th class="header-alt">2.2.0</th>
			<th>2.2.1</th>
			<th class="header-alt">2.2.2</th>
			<th>2.2.3</th>
			<th class="header-alt">2.3.0</th>
			<th>2.3.1</th>
			<th class="header-alt">2.3.2</th>
			<th>2.3.3</th>
			<th class="header-alt">2.5.0</th>
			<th>2.5.1</th>
			<th class="header-alt">2.6.0</th>
		</tr>
	</thead>
	<tbody>
<?php foreach($wpversion->getTypeNamesWithVersions($type) as $row) : ?>
	<tr>
		<td style="text-align: left"><?php echo $row['info_name']; ?></td>
		<td class="version-alt">
			<?php if( $row['version_0_71'] == 1 ) : ?><span class="ver-exists">0.71</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_1_0_0'] == 1 ) : ?><span class="ver-exists">1.0.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_1_0_1'] == 1 ) : ?><span class="ver-exists">1.0.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_1_0_2'] == 1 ) : ?><span class="ver-exists">1.0.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_1_2_0'] == 1 ) : ?><span class="ver-exists">1.2.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_1_2_1'] == 1 ) : ?><span class="ver-exists">1.2.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_1_2_2'] == 1 ) : ?><span class="ver-exists">1.2.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_1_5_0'] == 1 ) : ?><span class="ver-exists">1.5.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_1_5_1'] == 1 ) : ?><span class="ver-exists">1.5.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_1_5_2'] == 1 ) : ?><span class="ver-exists">1.5.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_0_0'] == 1 ) : ?><span class="ver-exists">2.0.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_0_1'] == 1 ) : ?><span class="ver-exists">2.0.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_0_4'] == 1 ) : ?><span class="ver-exists">2.0.4</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_0_5'] == 1 ) : ?><span class="ver-exists">2.0.5</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_0_6'] == 1 ) : ?><span class="ver-exists">2.0.6</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_0_7'] == 1 ) : ?><span class="ver-exists">2.0.7</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_0_8'] == 1 ) : ?><span class="ver-exists">2.0.8</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_0_9'] == 1 ) : ?><span class="ver-exists">2.0.9</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_0_10'] == 1 ) : ?><span class="ver-exists">2.0.10</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_0_11'] == 1 ) : ?><span class="ver-exists">2.0.11</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_1_0'] == 1 ) : ?><span class="ver-exists">2.1.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_1_1'] == 1 ) : ?><span class="ver-exists">2.1.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_1_2'] == 1 ) : ?><span class="ver-exists">2.1.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_1_3'] == 1 ) : ?><span class="ver-exists">2.1.3</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_2_0'] == 1 ) : ?><span class="ver-exists">2.2.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_2_1'] == 1 ) : ?><span class="ver-exists">2.2.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_2_2'] == 1 ) : ?><span class="ver-exists">2.2.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_2_3'] == 1 ) : ?><span class="ver-exists">2.2.3</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_3_0'] == 1 ) : ?><span class="ver-exists">2.3.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_3_1'] == 1 ) : ?><span class="ver-exists">2.3.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_3_2'] == 1 ) : ?><span class="ver-exists">2.3.2</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_3_3'] == 1 ) : ?><span class="ver-exists">2.3.3</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_5_0'] == 1 ) : ?><span class="ver-exists">2.5.0</span><?php else: ?>--<?php endif; ?>
		</td>
		<td>
			<?php if( $row['version_2_5_1'] == 1 ) : ?><span class="ver-exists">2.5.1</span><?php else: ?>--<?php endif; ?>
		</td>
		<td class="version-alt">
			<?php if( $row['version_2_6_0'] == 1 ) : ?><span class="ver-exists">2.6.0</span><?php else: ?>--<?php endif; ?>
		</td>
	</tr>
<?php endforeach; ?>
	</tbody>
</table>
<?php
}

require WP_VERSION_PATH.'/header.php';

$wpversion = new WP_Version_Implementation(false);
$wpversion->setup();
?>

<h3>Functions</h3>

<?php version_table_print($wpversion, WP_Version_Tokenizer::TYPE_FUNCTION); ?>

<h3>Classes</h3>

<?php version_table_print($wpversion, WP_Version_Tokenizer::TYPE_CLASS); ?>

<h3>Properties</h3>

<?php version_table_print($wpversion, WP_Version_Tokenizer::TYPE_PROPERTY); ?>

<h3>Constants</h3>

<?php version_table_print($wpversion, WP_Version_Tokenizer::TYPE_CONSTANT); ?>

<h3>Methods</h3>

<?php version_table_print($wpversion, WP_Version_Tokenizer::TYPE_METHOD); ?>

<?php require WP_VERSION_PATH.'/footer.php'; ?>